package com.eve.util.http;

import javax.servlet.http.HttpServletRequest;
import org.springframework.mobile.device.Device;
import org.springframework.mobile.device.DeviceUtils;
import org.springframework.mobile.device.site.SitePreference;
import org.springframework.mobile.device.site.SitePreferenceUtils;
import org.springframework.mobile.device.util.ResolverUtils;

/**
 * 移动设备判断
 * @author: ivan.yao<haif.yao@gmail.com>
 * @date: 16/7/31.
 */
public class DeviceResolverUtils {

    public static boolean isMobile(HttpServletRequest request){
        Device device = DeviceUtils.getCurrentDevice(request);
        SitePreference sitePreference = SitePreferenceUtils
                .getCurrentSitePreference(request);
        return ResolverUtils.isMobile(device, sitePreference) ||
                ResolverUtils.isTablet(device, sitePreference);
    }

}
